/****************************************************************************
 * FILE NAME: 		clock.c
 * 
 * PROJECT NAME: 	EGR330_Project
 * TEAM MEMBERS: 	Kevin Vermeer
 * 					Brandon Ross
 *					Tyler Selk
 *
 * 
 * CREATED: 		2 August 2011 (Brandon Ross)
 * LAST MODIFIED: 		
 * 
 * DESCRIPTION:		Handles functions necessary to operate clock
 ****************************************************************************/

#include <avr/io.h>
#include <inttypes.h>

#include "timer.h"
#include "clock.h"
#include "generic.h"

/*
 * FUNCTION NAME:	CLK_selectPrescaler
 * INPUTS:			CLK_PRESCALE (uint8_t)
 * OUTPUTS:			None
 * DESCRIPTION:		Sets clock prescale value
 */
static void CLK_selectPrescaler(uint8_t CLK_PRESCALE)
{
	CLKPR = setRegister(CLKPR, CLK_MASK_CLKPSX, CLK_PRESCALE, CLK_POS_CLKPSX);
}

/*
 * FUNCTION NAME:	CLK_initialize
 * INPUTS:			None
 * OUTPUTS:			None
 * DESCRIPTION:		Initializes clock settings
 */
void CLK_initialize(void)
{
	CLK_selectPrescaler(CLK_PRESCALE_DF1);
}

